package com.woniu.cms.psm.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.woniu.cms.psm.core.entity.Message;
import com.woniu.cms.psm.core.mapper.MessageMapper;
import com.woniu.cms.psm.core.service.IMessageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lilili
 * @since 2022-09-23
 */
@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements IMessageService {

    @Override
    public boolean alert(String userName) {
        List<Message> list = this.list(new LambdaQueryWrapper<Message>().eq(Message::getAcceptorName, userName).eq(Message::getStatus, 0));
        if(CollectionUtils.isEmpty(list)){
            return false;
        }else{
            return true;
        }
    }
}
